package com.oocl.Homework2;

import java.util.Random;

public class RandomNumber 
{
	private int a, b, k;
	private Random rand;
	
	private float percent;
	private int len;
	private int[] array;
	
	public RandomNumber(int a, int b)
	{
		this.a=a;
		this.b=b;
		rand = new Random();
	}
	public float Process(int k, float percent)
	{
		this.k=k;
		this.percent=percent;
		this.len=100;
		this.array=new int[len];
		
		int num=(int) (len*percent);
		for(int i=0;i<num;i++)
			array[i]=k;
		
		for(int i=num;i<len;i++)
		{
			array[i]=rand.nextInt(b+1-a)+a;
		}
		
		return (float)num/(float)this.len;
	}
	
	public void RandomPrint()
	{
		int len=100;
		int index=rand.nextInt(len);
		System.out.print(array[index]+" ");
	}
	
	
	public int getA() {
		return a;
	}
	public void setA(int a) {
		this.a = a;
	}
	public int getB() {
		return b;
	}
	public void setB(int b) {
		this.b = b;
	}
	public int getK() {
		return k;
	}
	public void setK(int k) {
		this.k = k;
	}
	public Random getRand() {
		return rand;
	}
	public void setRand(Random rand) {
		this.rand = rand;
	}
	public float getPercent() {
		return percent;
	}
	public void setPercent(float percent) {
		this.percent = percent;
	}
	public int getLen() {
		return len;
	}
	public void setLen(int len) {
		this.len = len;
	}
	public int[] getArray() {
		return array;
	}
	public void setArray(int[] array) {
		this.array = array;
	}
	
}
